<template>
  <div class="page">
    <div class="bg-white pd-s pdh-l">
      <b class="fs-l">{{group.name}}</b>
    </div>
    <div class="ta-c pd-xxl">
      转发到微信邀请小伙伴们加入吧！~~
    </div>
    <div class="fix-bottom bg-white pd-s pdh-xl">
      <button class="ui btn primary s" open-type="share">发送班级邀请</button>
    </div>
  </div>
</template>

<script>
import * as $group from '@/api/group'
import base from '@/mixins/base'

export default {
  mixins: [base],
  data () {
    return {
      group: {
        name: ''
      }
    }
  },
  async onPullDownRefresh() {
    try {
      let {groupId} = this.getParams()
      let group = await $group.getById({groupId})
      wx.stopPullDownRefresh()
    } catch (e) {
      this.$debug({err: e})
    }
  },
  onShareAppMessage() {
    return {
      title: this.group.name + '邀请你加入！',
      path: '/pages/group-invite/main?groupId=' + this.group.id
    }
  },
  async onLoad (options) {
    try {
      let {groupId} = options
      let group = await $group.getById({groupId})
      this.group = group
    } catch (e) {
      this.$debug({err: e})
    }
  },
  methods: {
  }
}
</script>

<style scoped lang="less">
</style>
